\ProvidesPackage{chapters/commands}[2024/06/06]

% PSAC

\newcommand{\set}[1]{\{{#1}\}}
\newenvironment{correctness}{\begin{proof}[正确性：]}{\end{proof}}

\newcommand{\pname}[1]{\mathsf{#1}}

\newcommand{\share}[1]{{\left\langle{#1}\right\rangle}}
\newcommand{\shareB}[1]{{\left\langle{#1}\right\rangle}^{B}}

\newcommand{\rec}{\pname{reconstruct}}

\newcommand{\HIST}{\mathbf{Hist}}

\newcommand{\adversary}{\mathcal{A}}


\newcommand{\proto}{\Pi}
\newcommand{\protocol}[1]{\Pi^{#1}}
\newcommand{\protocolTilde}[1]{\tilde{\Pi}^{#1}}
\newcommand{\protocolHat}[1]{\hat{\Pi}^{#1}}
\newcommand{\functionality}[1]{\mathcal{F}^{#1}}
% \newcommand{\protocol}[1]{\Pi^{\pname{#1}}}
% \newcommand{\protocolTilde}[1]{\tilde{\Pi}^{\pname{#1}}}
% \newcommand{\protocolHat}[1]{\hat{\Pi}^{\pname{#1}}}
% \newcommand{\functionality}[1]{\mathcal{F}^{\pname{#1}}}


% \newcommand{\Adv}{\mathcal{A}}
% \newcommand{\Sim}{\mathcal{S}}

% \newcommand{\functionality}{\mathcal{F}}
% \newcommand{\protocol}{\Pi}

% \newcommand{\SchemeName}{\mathsf{PSAC}}
% \newcommand{\Pmyscheme}{\protocol_{\SchemeName}}

% \newcommand{\View}{\mathsf{View}}


\newcommand{\Min}{\pname{Min}}
\newcommand{\Quantile}{\pname{Quantile}}
\newcommand{\Outlier}{\pname{Outlier}}
\newcommand{\ChiTest}{\pname{\chi^{2}\mbox{-}test}}
\newcommand{\UTest}{\pname{U\mbox{-}test}}
\newcommand{\UTestHE}{\pname{U\mbox{-}test\mbox{-}HE}}


\newcommand{\ctf}[1]{ct_{f,{#1}}}
\newcommand{\ctv}[1]{ct_{v,{#1}}}
\newcommand{\ctX}[1]{ct_{X,{#1}}}
\newcommand{\ctY}[1]{ct_{Y,{#1}}}
\newcommand{\CTSUM}{CT_{\textnormal{Sum}}}
\newcommand{\CTHist}{CT_{\HIST}}
\newcommand{\CTX}{CT_{X}}
\newcommand{\CTY}{CT_{Y}}
\newcommand{\CTUX}{CT_{UX}}
\newcommand{\CTUY}{CT_{UY}}
\newcommand{\CTWX}{CT_{WX}}
\newcommand{\CTWY}{CT_{WY}}




\newcommand{\PAdd}{\pname{PAdd}}
\newcommand{\CAdd}{\pname{CAdd}}
\newcommand{\PMul}{\pname{PMul}}
\newcommand{\CMul}{\pname{CMul}}


\newcommand{\Enc}{\pname{Enc}}
\newcommand{\Dec}{\pname{Dec}}
% ------------------------------------------------------------------------------

\newcommand{\XOR}{\pname{xor}}
\newcommand{\AND}{\pname{and}}
\newcommand{\NOT}{\pname{not}}
\newcommand{\Equal}{\pname{EQ}}
\newcommand{\Less}{\pname{LT}}
\newcommand{\LessOrEqual}{\pname{LE}}
\newcommand{\Multiply}{\pname{Mult}}
\newcommand{\Div}{\pname{Div}}
\newcommand{\Mux}{\pname{Mux}}
\newcommand{\Trunc}{\pname{Trunc}}
\newcommand{\BtoA}{\pname{B2A}}
\newcommand{\Mask}{\pname{Mask}}


% FESCAT
% \DeclareMathOperator{\st}{s.t.}
% \newcommand{\FrameworkName}{FESCAT}

\DeclareMathOperator{\dist}{dist}
\DeclareMathOperator{\Dist}{{D}}
\DeclareMathOperator{\DTW}{{DTW}}

\newcommand{\onelambda}{1^{\lambda}}

\newcommand{\SLBKeogh}{\pname{SLB\_Keogh}}
\newcommand{\SLBKeoghSD}{\pname{SLB\_Keogh\_SD}}
\newcommand{\SLBKim}{\pname{SLB\_Kim}}
\newcommand{\SLBKimFL}{\pname{SLB\_KimFL}}
\newcommand{\SDTW}{\pname{SDTW}}

\newcommand{\DCF}{\pname{DCF}}
\newcommand{\DDCF}{\pname{DDCF}}

\newcommand{\CMP}{\pname{CMP}}
\newcommand{\SQUARE}{\pname{SQ}}
\newcommand{\CMPSELECT}{\pname{C\&S}}
\newcommand{\ABS}{\pname{ABS}}
\newcommand{\MAX}{\pname{MAX}}
\newcommand{\MIN}{\pname{MIN}}
\newcommand{\Maxpool}{\pname{Maxpool}}
\newcommand{\Minpool}{\pname{Minpool}}

\newcommand{\gate}[1]{\mathcal{G}^{\pname{#1}}}
\newcommand{\gateHat}[1]{\hat{\mathcal{G}}^{\pname{#1}}}
\newcommand{\keysize}[1]{\pname{keysize}(#1)}
\newcommand{\Sim}[2]{\pname{Sim}^\pname{#1}_{#2}}
\newcommand{\fssgen}[2]{\pname{Gen}^\pname{#1}_{#2}}
\newcommand{\fsseval}[2]{\pname{Eval}^\pname{#1}_{#2}}
\newcommand{\fssin}{\mathsf{r}^\mathsf{in}}
\newcommand{\fssout}{\mathsf{r}^\mathsf{out}}
\newcommand{\uint}[2]{\mathsf{uint}_{#1}(#2)}
\newcommand{\sint}[2]{\mathsf{int}_{#1}(#2)}
\newcommand{\Func}[2]{f^\mathsf{#1}_{#2}}


% FSS
\newcommand{\gen}{\mathsf{Gen}}
\newcommand{\eval}{\mathsf{Eval}}
\newcommand{\sfin}{\mathsf{in}}
\newcommand{\sfout}{\mathsf{out}}
\newcommand{\fssgate}[1]{\mathcal{G}_{\mathsf{#1}}}
\newcommand{\fssfunc}[2]{g_{\mathsf{#1},{#2}}}
\newcommand{\fssoffsetfunc}[3]{\hat{g}^{\mathsf{[#1]}}_{\mathsf{#2},{#3}}}
% \newcommand{\DefineFssGate}[4]{\mathcal{G}_{\mathsf{#1}}=\fssfunc{#1}{#2}:{#3}\rightarrow{#4}}

% \newcommand{\indexlist}[2]{{#1}_{1},{#1}_{2},\ldots,{#1}_{#2}}
% \newcommand{\keysize}{\mathsf{keysize}}
% \newcommand{\LRS}{\gg_{\mathit{L}}}
% \newcommand{\ARS}{\gg_{\mathit{A}}}
% \newcommand{\sCMP}{\mathsf{sCMP}}
% \newcommand{\uCMP}{\mathsf{uCMP}}

\SetKwInput{Preprocessing}{\textbf{预处理阶段}}
\SetKwInput{Online}{\textbf{在线阶段}}
% \SetKwInput{Computation}{\textbf{计算}}


\DeclareMathOperator{\pk}{\mathsf{pk}}
\DeclareMathOperator{\sk}{\mathsf{sk}}
\DeclareMathOperator{\rlk}{\mathsf{rlk}}
\DeclareMathOperator{\cpk}{\mathsf{cpk}}

\DeclareMathOperator{\ct}{\mathit{ct}}


\DeclareMathOperator{\lcm}{lcm}
\DeclareMathOperator{\paillierL}{L}
\DeclareMathOperator{\paillierEnc}{\mathsf{Paillier.Enc}}
\DeclareMathOperator{\paillierDec}{\mathsf{Paillier.Dec}}



\DeclareMathOperator{\bfv}{\mathsf{BFV}}
\DeclareMathOperator{\bfvSetup}{\mathsf{BFV.Setup}}
\DeclareMathOperator{\bfvSecKeyGen}{\mathsf{BFV.SecKeyGen}}
\DeclareMathOperator{\bfvPubKeyGen}{\mathsf{BFV.PubKeyGen}}
\DeclareMathOperator{\bfvRelinKeyGen}{\mathsf{BFV.RelinKeyGen}}
\DeclareMathOperator{\bfvEnc}{\mathsf{BFV.Enc}}
\DeclareMathOperator{\bfvDec}{\mathsf{BFV.Dec}}
\DeclareMathOperator{\bfvEval}{\mathsf{BFV.Eval}}
\DeclareMathOperator{\bfvRelinearize}{\mathsf{BFV.Relinearize}}
\DeclareMathOperator{\bfvAdd}{\oplus}
\DeclareMathOperator{\bfvMul}{\otimes}

\DeclareMathOperator{\mbfvSetup}{\mathsf{MBFV.Setup}}
\DeclareMathOperator{\mbfvSecKeyGen}{\mathsf{MBFV.SecKeyGen}}
\DeclareMathOperator{\mbfvEncKeyGen}{\mathsf{MBFV.EncKeyGen}}
\DeclareMathOperator{\mbfvRelinKeyGen}{\mathsf{MBFV.RelinKeyGen}}
\DeclareMathOperator{\mbfvKeySwitch}{\mathsf{MBFV.KeySwitch}}
\DeclareMathOperator{\mbfvPubKeySwitch}{\mathsf{MBFV.PubKeySwitch}}
\DeclareMathOperator{\mbfvEtoS}{\mathsf{MBFV.Enc2Share}}
\DeclareMathOperator{\mbfvStoE}{\mathsf{MBFV.Share2Enc}}


\newcommand{\mbfv}{\mathsf{MBFV}}
\newcommand{\Pack}{\mathsf{Pack}}
\newcommand{\Unpack}{\mathsf{Unpack}}
